Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default protocol/port when destination is service in antrea traceflow #6601

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

Atish-iaf
Copy link
Contributor

If destination protocol/port isn't provided when destination is service in antrea traceflow, it just uses destinaton service's IP(clusterIP) and runs traceflow as Pod-to-IP(icmp) case which is incorrect.

To fix this, we use the first protocol/port from the service's 'ports' list as default value.

Fixes #6594

@Atish-iaf Atish-iaf added kind/bug Categorizes issue or PR as related to a bug. area/ops/traceflow Issues or PRs related to the Traceflow feature labels Aug 8, 2024
@Atish-iaf Atish-iaf changed the title Use default port/protocol when dst is service in Traceflow Use default protocol/port when destination is service in antrea traceflow Aug 8, 2024
@rajnkamr rajnkamr added this to the Antrea v2.2 release milestone Aug 8, 2024
If destination protocol/port isn't provided when destination is service
in antrea traceflow, it just uses destinaton service's IP(clusterIP) and
runs traceflow as Pod-to-IP(icmp) case which is incorrect.

To fix this, we use the first protocol and port from the service's 'ports'
list as default value.

Fixes antrea-io#6594

Signed-off-by: Kumar Atish <[email protected]>
Comment on lines +497 to +501
case corev1.ProtocolTCP:
packet.IPProto = protocol.Type_TCP
packet.TCPFlags = uint8(2)
case corev1.ProtocolUDP:
packet.IPProto = protocol.Type_UDP
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switch statement does not include a default case. While the current implementation handles TCP and UDP, if the service protocol is SCTP which is also currently not supported , we could add a default case !
default:
// Handle unsupported protocols, maybe log a warning

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaults to ICMP which is consistent with other cases also.
In this case, the behaviour will be run traceflow as Pod-to-IP(Service's ClusterIP) with ICMP protocol.

@antoninbas
Copy link
Contributor

/test-all

@antoninbas antoninbas added the action/release-note Indicates a PR that should be included in release notes. label Aug 23, 2024
@antoninbas antoninbas merged commit 7c02219 into antrea-io:main Aug 26, 2024
56 of 59 checks passed
@rajnkamr rajnkamr added the kind/documentation Categorizes issue or PR as related to a documentation. label Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/release-note Indicates a PR that should be included in release notes. area/ops/traceflow Issues or PRs related to the Traceflow feature kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to a documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Antrea Traceflow should validate that destination port isn't empty when destination is a K8s Service
3 participants